package com.inexas.cu.klient.register;

import org.junit.*;
import com.google.gwt.user.client.ui.*;
import com.google.inject.*;
import com.inexas.cu.client.register.*;
import com.inexas.cu.guice.*;
import com.inexas.cu.server.*;

@SuppressWarnings("unused")
public class ItRegistration {
    private final static String firstName = "First";
	private final static String lastName = "Last";
	private final static String accountName = "account";
	private final static String password = "password";
	private static Injector factory;
	private SignInPresenter presenter;
	private Widget view;

	@BeforeClass
	public static void beforeClass() {
		factory = GuiceFactory.getInjector(new TestModule());
	}


	@Before
	public void setup() {
		presenter = factory.getInstance(SignInPresenter.class);
		//view = presenter.getView();
	}

	@Test
	public void createAccount() {
//
//		// Invalid sign in (no account yet)
//		expect(view.getAccountName()).andReturn(accountName);
//		expect(view.getPassword()).andReturn(password);
//		view.displayMessage((String)anyObject());
//		expectLastCall().anyTimes();
//		replay(view);
//		presenter.doSignIn();
//		assertNotNull(presenter.getErrorMessage());
//		verify(view);
//
//		// Create account...
//		reset(view);
//		expect(view.getFirstName()).andReturn(firstName);
//		expect(view.getLastName()).andReturn(lastName);
//		expect(view.getAccountName()).andReturn(accountName);
//		expect(view.getPassword()).andReturn(password);
//		view.displayMessage((String)anyObject());
//		expectLastCall().anyTimes();
//		replay(view);
//		presenter.doRegister();
//		assertNull(presenter.getErrorMessage());
//		verify(view);
//
//		// Sign in...
//		reset(view);
//		expect(view.getAccountName()).andReturn(accountName);
//		expect(view.getPassword()).andReturn(password);
//		view.displayMessage((String)anyObject());
//		expectLastCall().anyTimes();
//		replay(view);
//		assertNull(presenter.getCurrentAccountName());
//		presenter.doSignIn();
//		assertEquals(presenter.getCurrentAccountName(), accountName);
//		verify(view);
//
//		// Sign out...
//		reset(view);
//		view.displayMessage((String)anyObject());
//		expectLastCall().anyTimes();
//		replay(view);
//		assertNotNull(presenter.getCurrentAccountName());
//		presenter.doSignOut();
//		assertNull(presenter.getCurrentAccountName());
//		verify(view);
//
//		// Deregister...
//		reset(view);
//		expect(view.getAccountName()).andReturn(accountName);
//		expect(view.getPassword()).andReturn(password);
//		expect(view.getAccountName()).andReturn(accountName);
//		view.displayMessage((String)anyObject());
//		expectLastCall().anyTimes();
//		replay(view);
//		presenter.doSignIn();
//		presenter.doDeregister();
//		verify(view);
//
	}

}
